var t = getApp();

Page({
    data: {
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        listData: [],
        networkLoading: !1,
        default_logo: ""
    },
    onLoad: function(t) {
        this.getListData();
    },
    onReady: function() {},
    initData: function() {
        this.setData({
            page: 1,
            total_page: 0,
            isLoadMore: !0,
            networkLoading: !1
        });
    },
    getListData: function() {
        var a = this;
        this.initData();
        var e = t.getNetAddresss("plugin.present-project.frontend.project.index");
        t._postNetWork({
            url: e,
            success: function(e) {
                var o = e.data;
                if (1 != o.result) return t.tips(o.msg);
                a.data.total_page = o.data.person_list.last_page, a.data.total_page || (a.data.total_page = 0), 
                a.setData({
                    listData: o.data.person_list.data,
                    default_logo: o.data.default_logo,
                    networkLoading: !0
                });
            }
        });
    },
    _getMoreData: function() {
        var a = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var e = t.getNetAddresss("plugin.present-project.frontend.project.index"), o = {
                page: this.data.page
            };
            t._postNetWork({
                url: e,
                data: o,
                success: function(t) {
                    var e = t.data;
                    if (a.data.isLoadMore = !0, 1 === e.result) {
                        var o = a.data.listData.concat(e.data.person_list.data);
                        a.setData({
                            listData: o
                        });
                    } else a.data.page = a.data.page - 1, a.data.isLoadMore = !1;
                }
            });
        }
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    getDetails: function(t) {
        var a = t.currentTarget.dataset.id, e = "/packageI/donation_project/donationProjectDetails/donationProjectDetails?id=".concat(a);
        wx.navigateTo({
            url: e
        });
    },
    handImagePreview: function(t) {
        var a = t.currentTarget.dataset.src;
        wx.previewImage({
            urls: [ a ]
        });
    },
    onShareAppMessage: function() {}
});